namespace Digitalmes.Domain.Entities.Mes.Masters;

/// <summary>
/// 生产线
/// </summary>
[SugarTable("md_line")]
public sealed class MdLine : AuditedEntity, ISoftDelete
{
    /// <summary>
    /// 产线编号
    /// </summary>
    [NotNull]
    public string? LineCode { get; set; }

    /// <summary>
    /// 产线名称
    /// </summary>
    [NotNull]
    public string? LineName { get; set; }

    /// <summary>
    /// 所在车间 Id，可为 null。
    /// </summary>
    public long? WorkshopId { get; set; }

    /// <summary>
    /// 车间
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(WorkshopId))]
    public MdWorkshop? Workshop { get; set; }

    /// <summary>
    /// 负责人
    /// </summary>
    public string? Principal { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int Order { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    public string? Remark { get; set; }

    /// <summary>
    /// 启用状态（0->停用，1->启用）
    /// </summary>
    public EnabledStatusEnum Status { get; set; }

    public bool IsDeleted { get; set; }

    /// <summary>
    /// 工站集合
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(MdWorkstation.LineId))]
    public List<MdWorkstation>? Workstations { get; set; }
}
